classdef dotsDrawableLines < dotsDrawable
    % @class dotsDrawableLines
    % Draw one or multiple lines at once.
    %
    % @ingroup drawable
    
    properties (SetObservable = true)
        % a starting x-coordinate for each line (degrees visual angle,
        % centered)
        xFrom = 0;
        
        % an ending x-coordinate for each line (degrees visual angle,
        % centered)
        xTo = 1;
        
        % a starting y-coordinate for each line (degrees visual angle,
        % centered)
        yFrom = 0;
        
        % an ending y-coordinate for each line (degrees visual angle,
        % centered)
        yTo = 1;
        
        % the width of all lines (pixels)
        width = 1;
        
        % the color for all lines ([RGB])
        color = [255 255 255];
        
        % whether to do anti-aliasing for diagonal lines (logical)
        smooth = false;
    end
    
    methods
        % Constructor takes no arguments.
        function self = dotsDrawableLines
            self = self@dotsDrawable;
            self.color = self.foregroundColor;
        end
        
        % Draw one or more lines at once.
        function draw(self)
            % mglLines2 sets antialiasing internally,
            %   so can't use dotsMglSmoothness('lines', ...)
            
            mglLines2( ...
                self.xFrom, ...
                self.yFrom, ...
                self.xTo, ...
                self.yTo, ...
                self.width, ...
                self.color, ...
                double(self.smooth));
        end
    end
end